#pragma once
#include <iostream>
#include <chrono>   

using namespace std;
namespace cbim
{
	class BTimer
	{
	public:
		BTimer(string message)
		{
			_message = message;
			start = std::chrono::system_clock::now();
		}

		~BTimer()
		{
			auto end = std::chrono::system_clock::now();
			auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
			cout << _message.data()
				<< "Spend time is "
				<< double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den * 1000
				<< " ms" << endl;
		}

	private:
		std::chrono::time_point<std::chrono::system_clock> start;
		std::string _message;
	};
}